package com.imooc.collection;

/**
 * @author duyong
 * @version 1.0
 * @date 2019/10/23 21:19
 */

import java.util.ArrayList;
import java.util.List;

/**
 * 创建list容器
 */
public class ListTest {
    //创建List接受容器
    private List CoursesToSelect;
    //创建构造器
    public ListTest(){
       //实例化这个接口 并赋值給CoursesToSelect
        this.CoursesToSelect=new ArrayList();
    }

    /**
     * list添加Course进行测试
     */
    public  void addTest(){
      //创建Course实体类并初始化
        Course course = new Course("1","数据结构");
        //添加到list数组
        CoursesToSelect.add(course);
       Course course1 = (Course) CoursesToSelect.get(0);
        System.out.println(course1.getId()+course1.getName());
    }
    public static void main(String[] args){
        ListTest listTest = new ListTest();
        listTest.addTest();
    }
    public List getCoursesToSelect() {
        return CoursesToSelect;
    }

    public void setCoursesToSelect(List coursesToSelect) {
        CoursesToSelect = coursesToSelect;
    }
}
